package com.longrise.android.byjk.utils;


/**
 * Created by sujizhong on 16/4/14.
 *
 * 屏蔽了谷歌分析 20171103
 */
public class Tracker_Google {

    private static Tracker_Google mTracker_google = null;

    /**
     * 勿修改
     */
    public static final String PROPERTY_ID = "UA-7030246000005-4";

    private Tracker_Google() {
    }

    public static Tracker_Google getInstance() {
        if (mTracker_google == null) {
            synchronized (Tracker_Google.class) {
                if (mTracker_google == null) {
                    mTracker_google = new Tracker_Google();
                }
            }
        }
        return mTracker_google;
    }

    /**
     * 界面跟踪
     */
    public void addGoogleScreenName(String trackerName) {
//        try {
//            Tracker t = getTracker(TrackerName.APP_TRACKER);
//            t.setScreenName(trackerName);
//            t.send(new HitBuilders.AppViewBuilder().build());
//        } catch (Exception e) {
//            e.printStackTrace();
//        }
    }

    /**
     * 事件跟踪
     */
    public void addEvent(String cate, String action, String lable) {
//        try {
//            Tracker t = getTracker(TrackerName.APP_TRACKER);
//            t.send(new HitBuilders.EventBuilder().setCategory(cate).setAction(action).setLabel(lable).build());
//        } catch (Exception e) {
//            e.printStackTrace();
//        }
    }

//    public enum TrackerName {
//        APP_TRACKER, GLOBAL_TRACKER, ECOMMERCE_TRACKER,
//    }

//    public HashMap<TrackerName, Tracker> mTrackers = new HashMap<>(16);

//    public synchronized Tracker getTracker(TrackerName appTracker) {
//        if (!mTrackers.containsKey(appTracker)) {
//            GoogleAnalytics analytics = GoogleAnalytics.getInstance(BYJKAppLike.getAPP());
//            Tracker t = (appTracker == TrackerName.APP_TRACKER) ? analytics.newTracker(PROPERTY_ID) : (appTracker == TrackerName.GLOBAL_TRACKER) ? analytics.newTracker(R.xml.global_tracker) : analytics.newTracker(R.xml.ecommerce_tracker);
//            t.enableAdvertisingIdCollection(true);  //启用展示广告功能
//            mTrackers.put(appTracker, t);
//        }
//        return mTrackers.get(appTracker);
//    }
}
